package com.fuqi.android.zhongcai.base.view.activity;

import android.graphics.Color;
import android.os.Bundle;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;
import com.fuqi.android.zhongcai.R;
import com.fuqi.android.zhongcai.utils.funclass.MyCountDownTimer;
import com.fuqi.android.zhongcai.utils.ActivityUtils;

public class SplashActivity extends BaseActivity implements MyCountDownTimer.ICountDownTimer {


    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
//        ProvinceUtils.handleProvinceJSON();
    }


    private void goHomeActivity() {
        ActivityUtils.startActivityNeedLogin(SplashActivity.this,MainTabActivity.class);
        this.finish();
    }

    private void configStausBar(){

        if (hasKitKat() && !hasLollipop()) {
            getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
        } else if (hasLollipop()) {
            Window window = getWindow();
            window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS
                    | WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION);
            window.getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
                    | View.SYSTEM_UI_FLAG_LAYOUT_STABLE);
            window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
            window.setStatusBarColor(Color.parseColor("#00ffffff"));
        }

    }


    @Override
    public void onFinish() {

        goHomeActivity();

    }

    @Override
    public void onTick() {

    }


    @Override
    public void initView() {

        configStausBar();

    }

    @Override
    public void initListener() {
        new MyCountDownTimer(3000,1000,this).start();
    }

    @Override
    public void initData() {



    }



    @Override
    public boolean hasTitleBar() {
        return false;
    }

    @Override
    public int getLayoutId() {
        return R.layout.activity_splash;
    }
}
